package org.koyi.birrapp;

import org.koyi.fragments.BuscarFragment;
import org.koyi.fragments.DestacadosListFragment;
import org.koyi.fragments.FavoritosListFragment;
import org.koyi.fragments.LocalesCercanosFragment;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTabHost;
import android.view.WindowManager;


public class MainActivity extends FragmentActivity{
	
	private FragmentTabHost mTabHost;
	
	@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);

        mTabHost = (FragmentTabHost)findViewById(android.R.id.tabhost);
        
        mTabHost.setup(this, getSupportFragmentManager(), R.id.realtabcontent);
        
        mTabHost.addTab(mTabHost.newTabSpec("destacados")
        						.setIndicator("", 
        									  getResources().getDrawable(R.drawable.star)), 
        									  DestacadosListFragment.class, 
        									  null);
        
        mTabHost.addTab(mTabHost.newTabSpec("favoritos")
        						.setIndicator("", 
        									  getResources().getDrawable(R.drawable.heart)), 
        									  FavoritosListFragment.class, 
        									  null);

        
        mTabHost.addTab(mTabHost.newTabSpec("birra")
        						.setIndicator("", 
        									  getResources().getDrawable(R.drawable.beer_go)), 
        									  LocalesCercanosFragment.class, 
        									  null);
        
        mTabHost.addTab(mTabHost.newTabSpec("buscar")
        						.setIndicator("", 
        									  getResources().getDrawable(R.drawable.search)), 
        									  BuscarFragment.class, 
        									  null);
    }
	
	@Override
	public void onBackPressed() {
		this.moveTaskToBack(true);
	}
}
